package com.woniuxy.test03;

import org.junit.Test;

/**
 * @Author author
 * @Create 2023-09-12 9:50
 */
public class MyTest01 {

    @Test
    public void test01(){
        String s1="aaa";
        String s2="aaa";
        System.out.println("s1==s2"+(s1==s2));//true
        System.out.println("s1.equals(s2)"+(s1.equals(s2)));//true
        String s3=new String("aaa");
        String s4=new String("aaa");
        System.out.println("s1==s2"+(s3==s4));//false
        System.out.println("s1.equals(s2)"+(s3.equals(s4)));//true
        String s5="bbb";
        s1="bbb";
        String s7=new String ("bbb");
        System.out.println();
    }

    public void testString(String str,StringBuilder sb){
        str+="aaa";
        sb=new StringBuilder("yyy");
        System.out.println(str);
        System.out.println(sb);
    }

    @Test
    public void test02(){
        String str="xxx";
        StringBuilder sb=new StringBuilder("xxx");
        testString(str,sb);
        System.out.println(str);
        System.out.println(sb);
    }

    @Test
    public void test03(){
        StringBuilder sb=new StringBuilder("aa");
        sb.append("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
        System.out.println(sb);

    }

}
